package com.jtpay.payresulthelper.util;

/**
 * Created by Joe on 2017/09/04 14:56.
 * global constants
 */

public class PayContext {
    public final static boolean Debug = true;
    public static boolean isFirst = false;
    final static String LOG_DIR_NAME = "log";
    public final static String SP_KEY_ALI_ACCOUNT_NAME = "ALI_ACCOUNT";//default 18000357213
    public final static String SP_KEY_WX_ACCOUNT_NAME = "WX_ACCOUNT";//default Rico7213、
    public final static String SP_KEY_DEVICE_IP = "DEVICE_IP";

    //Whether the account in the production process has changed
    public final static String SP_KEY_ALI_PRODUCT_STEP_RESET = "STEP_RESET";//
    public final static String SP_KEY_ALI_REGISTER_INFO = "ALI_REGISTER_INFO";//
    public final static String SP_KEY_DB_DELETE_DAYS = "DB_DELETE_DAYS";//
    public final static String SP_KEY_PULSE_SPEED = "PULSE_SPEED";//

    public final static String PAY_RESULT_NOTICE_KEY = "BpKSu3IOI0M+rN3SNytDvw==";//
    public final static String PAY_LONG_CONNECT_KEY = "123123123";//
    public final static int LOG_CLEAN_LINE = 200;//when match the value  clean log content

    public final static int API_NOTICE_ERROR_COUNT_DEF = 2;

    public static int API_ERROR_COUNT = 0;
    public final static int API_TASK_ERROR_COUNT_DEF = 6;
    public final static int ACCESSIBILITY_SERVICE_ERROR_COUNT_DEF = 10;

    public static final int DB_DELETE_TABLE_DAYS_DEF = 3;
    public final static int DB_DELETE_TABLE_TOTAL_NUM_DEF = 100;
    public static int DB_DELETE_TABLE_DAYS = DB_DELETE_TABLE_DAYS_DEF;
    /*
        static param with default value
    */
    // 0 default  1 start   2 has result    4 wx cookie without verify account
    public static int VerifyAccountStatus = 0;
    public static boolean VerifyAccountResult = false;
    public static int BILL_STATUS = 0;//0 def 1 need 2 do  3 done
    public static int ORDER_TASK_STATUS = 0;//0 def 1 normal 2 order_supplement

    public static String PAYMENT = "4";//支付方式  4 ali, 3 wx
    public final static String PAYMENT_ALI = "4";//支付方式  ali
    public final static String PAYMENT_WX = "3";//支付方式  wx
    public static String ALI_ACCOUNT = null;
    public final static String ALI_ACCOUNT_DEF = "18000357213";
    public final static int OFFICE_NUM = 10; // upload data list size
    public final static int OFFICE_LIMIT_NUM = 1; // upload data limit size

    public static final String ACTION_VERIFY_RESULT = "com.jtpay.product.VERIFY_RESULT";
    public static final String ACTION_UPLOAD_PAY_RESULT = "com.jtpay.product.UPLOAD_PAY_RESULT";
    public static final String ACTION_SHOW_LOG = "com.jtpay.product.SHOW_LOG";
    public static final String ACTION_ALI_OFFLINE = "com.jtpay.product.ALI_OFFLINE";
    public static final String ACTION_ALI_DATE_FILTER = "com.jtpay.product.ALI_DATE_FILTER";

    public static final String EXTRA_START_DATE = "EXTRA_START_DATE";
    public static final String EXTRA_END_DATE = "EXTRA_END_DATE";

    public static final String SHOW_LOG_CONTENT = "SHOW_LOG_CONTENT";

    public static void resetErrorCount() {
        API_ERROR_COUNT = 0;
    }

    public static boolean isLimited() {
        return API_ERROR_COUNT >= API_TASK_ERROR_COUNT_DEF;
    }

    public static void resetAliAccount() {
        ALI_ACCOUNT = null;
    }
}
